import java.awt.*;

import javax.swing.JLabel;
import javax.swing.WindowConstants;

public class NoBorderDialog extends javax.swing.JFrame {
    private JLabel text;
    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension screensize = tk.getScreenSize();
    int height = screensize.height;
    int width = screensize.width;
    private String str = null;

    public NoBorderDialog(String str) {
        this.str = str;
        new Thread(new Runnable() {
            @Override
            public void run() {
                initGUI();
            }
        }).start();
    }

    private void initGUI() {
        try {
            setUndecorated(true);
            setLocationRelativeTo(null);
            setVisible(true);
            setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            {
                Font font = new Font("宋体", Font.PLAIN, 30);
                text = new JLabel("<html>" + str + "</html>", JLabel.CENTER);
                text.setFont(font);
                getContentPane().add(text, BorderLayout.CENTER);
            }

            pack();
            setBounds(width / 2 - 180, height / 2 - 100, 360, 200);
            setBackground(new java.awt.Color(199, 2, 2, 60));
            try {
                Thread.sleep(750);
            } catch (InterruptedException e1) {
                e1.printStackTrace();
            }
            dispose();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
